package br.com.playonline.rest;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import br.com.playonline.bussines.SorteioBU;
import br.com.playonline.dto.BolaoDTO;
import br.com.playonline.dto.SorteioDTO;

@RestController
@RequestMapping(value = "/sorteio")
public class SorteioRest {

	@Autowired
	SorteioBU sorteioBU;
	
	@RequestMapping(value = "/inserir",method = RequestMethod.POST)
	public @ResponseBody void inserir(@RequestBody SorteioDTO sorteioDTO){
		this.sorteioBU.inserir(sorteioDTO);
	}

	@RequestMapping(value = "/findAll",method = RequestMethod.GET)
	public @ResponseBody List<SorteioDTO> findBolaoByID(){
		return this.sorteioBU.findAll();
	}

	@RequestMapping(value = "/findSorteioByID/{id}",method = RequestMethod.GET)
	public @ResponseBody SorteioDTO findSorteioByID(@PathVariable("id") Long id){
		return this.sorteioBU.findSorteioByID(id);
	}
	
	@RequestMapping(value = "/findSorteios",method = RequestMethod.GET)
	public @ResponseBody List<SorteioDTO> findSorteios(){
		return this.sorteioBU.findSorteios();
	}
	
}
